#include "rules.h"

using namespace std;
using namespace mongo;
int main()
{
    mquery obj;
    list<string> matched1,matched2;
    list<string>::iterator i;
    BSONObjBuilder x;
    x.append("DIP","192.168.4.72");
    x.append("CVE","1");
    obj.printRules();
	BSONObj b=x.obj();
    BSONObjBuilder y;
    y.append("DIP","192.168.4.73");
    y.append("auth","fail");
    BSONObj c=y.obj();
    matched1=obj.match(b);
    cout<<"match for:"<<b.toString()<<endl;
    for(i=matched1.begin();i!=matched1.end();i++)
    {
        cout<<*i<<endl;
    }
    matched2=obj.match(c);
    cout<<"match for:"<<c.toString()<<endl;
    for(i=matched2.begin();i!=matched2.end();i++)
    {
        cout<<*i<<endl;
    }

	return 0;
}
